package main

import (
	"crypto/tls"
	"io/ioutil"
	"log"
	"net/http"
)

func clientStart() {
	var (
		resp   *http.Response
		err    error
		body   []byte
		tr     *http.Transport
		client *http.Client
	)
	// 配置tls参数
	tr = &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	}

	client = &http.Client{Transport: tr}
	// 请求接口
	resp, err = client.Get("https://127.0.0.1:9898/test")

	if err != nil {
		log.Fatalln("接口请求失败", err)
	}

	defer resp.Body.Close()
	// 读取body数据
	body, err = ioutil.ReadAll(resp.Body)

	log.Println("请求结果", string(body))
}
